<?php
ini_set("display_errors",0);
error_reporting(0);
if($_GET["acao"] == logar){
$logincorreto=admin;
$senhacorreta="123casa";
$user=$_POST["login"];
$pass=$_POST["senha"];	
if($user==$logincorreto && $pass==$senhacorreta){
setcookie("logado","1");
echo'
<script type="text/javascript">
alert("Redirecionando...");
location="logado.php";
</script>
';
}else{
echo'
<script type="text/javascript">
alert("Usuario ou senha incorretos, digite novamente...");
location="index.php";
</script>
';	
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<h1>Login:
</h1>
<form id="formulario" name="formulario" method="post" action="?acao=logar">
  Usuário:
  <label for="login"></label>
  <input type="text" name="login" id="login" /> 
  Senha:
  <label for="senha"></label>
  <input type="password" name="senha" id="senha" />
  <input type="submit" name="logar" id="logar" value="Logar" />
  <input type="reset" name="limpar" id="limpar" value="Limpar" />
</form>
<p>&nbsp;</p>
</body>
</html>